<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台管理系统</title>
<js href="__PUBLIC__/Js/Jquery/jquery-1.4.4.min.js" />
<link href="../Public/admin/css/golbal.css" rel="stylesheet" type="text/css" />
<link href="../Public/admin/css/adlist.css" rel="stylesheet" type="text/css" />
</head>

<body style="height:800px;">
<div class="tittle">
<span>资源库管理</span>
<a href="{:U('Category/addcate',array('catepid'=>$catepid,'model'=>$model))}">添加栏目</a>
</div>
<div class="detab">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr class="thi">
<th width="169">分类名称</th>
<th width="100">英文名</th>
<th width="95">所属资源库</th>
<th width="100">备注</th>
<th width="121">是否显示</th>
<th width="95">排序</th>
<th width="123">操作</th>
</tr>
<volist id="vo" name="list">
<tr>
<td><img class="imico" style="cursor:pointer;" onclick="showTr('{$vo.cateid}')" id="imgico_{$vo.cateid}" src="../Public/admin/images/plus.jpg"/><span><a href="javascript:void(0);" onclick="showTr('{$vo.cateid}')">{$vo.catename}</a></span>
</td>
<td>{$vo.engname}</td>
<td>知识题</td>
<td>{$vo.remark}</td>
<eq name="vo['status']" value="0">
<td class="forbid"><span>否</span><a href="javascript:void(0);" onclick="enable({$vo.cateid});"> </a></td>
<else/>
<td class="start"><span>是</span><a href="javascript:void(0);" onclick="forbidden({$vo.cateid});"> </a></td>
</eq>
<td>{$vo.orders}</td>
<td class="last_bt"><a href="{:U('Category/editcate',array('cateid'=>$vo['cateid'],'catepid'=>$vo['catepid'],'model'=>$model))}" class="edit">编辑</a><a href="javascript:void(0);" onclick="dele('{$vo.cateid}');" class="move">删除</a></td>
</tr>
<php>
	foreach($vo['slist'] as $key => $val){
</php>
<tr class="show_{$vo.cateid} unfold" style="display:none;">
<td><span class="utitle">{$val.catename}</span></td>
<td>{$val.engname}</td>
<td>{$vo.catename}</td>
<td>{$val.remark}</td>
<eq name="val['status']" value="0">
<td class="forbid"><span>否</span><a href="javascript:void(0);" onclick="enable({$val.cateid});"> </a></td>
<else/>
<td class="start"><span>是</span><a href="javascript:void(0);" onclick="forbidden({$val.cateid});"> </a></td>
</eq>
<td>{$val.orders}</td>
<td class="last_bt"><a href="{:U('Category/editcate',array('cateid'=>$val['cateid'],'catepid'=>$vo['catepid'],'model'=>$model))}" class="edit">编辑</a><a href="javascript:void(0);" onclick="dele('{$val.cateid}');" class="move">删除</a></td>
</tr>
<php>}</php>
</volist>
</tbody>
</table>
</div>

<div class="num" style="display:none;">

</div>
<div class="clear"></div>
<script type="text/javascript">
function showTr(cid)
{
	if($(".show_"+cid).is(":hidden")){
		$("img.imico").attr("src","../Public/admin/images/plus.jpg");
		$("#imgico_"+cid).attr("src","../Public/admin/images/minus.jpg");
		$("tr.unfold").hide();
		$(".show_"+cid).show();
	}else{
		$("#imgico_"+cid).attr("src","../Public/admin/images/plus.jpg");
		$(".show_"+cid).hide();
	}
	
}

//禁用用户
function forbidden(cateid) {
	cateid = cateid ? cateid : getChecked();
	cateid = cateid.toString();
	if(cateid == '' || !confirm('确定要取消启用？')) return false;
	$.post("{:U('Category/forbidden')}", {cateid:cateid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('禁用失败');
	});
}

//启用用户
function enable(cateid) {
	cateid = cateid ? cateid : getChecked();
	cateid = cateid.toString();
	$.post("{:U('Category/enable')}", {cateid:cateid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('激活失败');
	});
}

//删除用户
function dele(cateid){
	cateid = cateid ? cateid : getChecked();
	cateid = cateid.toString();
	if(cateid == '' || !confirm('确定要删除目录？')) return false;
	$.post("{:U('Category/dele')}", {cateid:cateid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('该目录删除失败');
	});
}
</script>

</body>
</html>
